package com.ruoyi.web.controller.tourism;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.Groups;
import com.ruoyi.system.service.IGroupsService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 演出团队
 */
@RestController
@RequestMapping("/groups")
public class GroupsController extends BaseController
{
    @Autowired
    private IGroupsService groupsService;

    /**
     * 查询演出团队
     */
    @GetMapping("/list")
    public TableDataInfo list(Groups groups)
    {
        startPage();
        List<Groups> list = groupsService.selectGroupsList(groups);
        return getDataTable(list);
    }

    /**
     * 获取演出团队‘详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(groupsService.selectGroupsById(id));
    }

    /**
     * 新增演出团队‘
     */
    @PostMapping
    public AjaxResult add(@RequestBody Groups groups)
    {

        return toAjax(groupsService.insertGroups(groups));
    }

    /**
     * 修改演出团队‘
     */
    @PutMapping
    public AjaxResult edit(@RequestBody Groups groups)
    {
        return toAjax(groupsService.updateGroups(groups));
    }

    /**
     * 删除演出团队‘
     */
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(groupsService.deleteGroupsByIds(ids));
    }
}
